package com.wanglei.rdd.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Spark03_glom {

  def main(args: Array[String]): Unit = {

    //
    val conf = new SparkConf().setMaster("local[2]").setAppName("map")
    val sc = new SparkContext(conf)

    // glom 将一个分区的数据形成一个数组
    val rdd: RDD[Int] = sc.makeRDD(List(1,2,3,4), 2)
    val value: RDD[Array[Int]] = rdd.glom()
    value.collect().foreach(data => println(data.mkString(",")))

    //
    sc.stop()

  }

}
